<?php
	require_once "../include/init.php";
	$act = RequestVal('act','get');
	switch($act){
		case "checkConnectDB":
			$host = RequestVal('host','get');
			$port = RequestVal('port','get');
			$user = RequestVal('user','get');
			$pwd = RequestVal('pwd','get');
			//$result = array('result'=>'success','code'=>'0','content'=>array('库1','库2','库3'));
			$db = "information_schema";
			$DB = new DB($host,$port,$db,$user,$pwd);
			if($DB){
				$data = $DB->query("select table_schema from `tables` group by table_schema",true);
				$result = array('result'=>'success','code'=>'0','content'=>$data['record']);
			}else{
				$result = array('result'=>'fail','code'=>'','content'=>'');	
			}
			echo ReturnJSON($result);
			break;
		case "install":
			file_put_contents($Config['InstallTag'],"installed ".date("Y-m-d H:i:s")."\r\n".print_r($_POST,true)."\r\n\r\n",FILE_APPEND);
			echo 'success';
			break;
		default:
			echo 'error';
			break;
	}